#ifndef MYOPENGLWINDOW_H
#define MYOPENGLWINDOW_H

#include <QObject>
#include <QWindow>
#include <QOpenGLFunctions>
#include <QOpenGLPaintDevice>

class MyOpenGLWindow : public QWindow, protected QOpenGLFunctions
{
    Q_OBJECT
public:
    explicit MyOpenGLWindow(QWindow *parent = nullptr);
    // ~MyOpenGLWindow();

    virtual void render( QPainter *painter );
    virtual void render();
    virtual void initialize();

    void setAnimating( bool animating );

protected:
    bool event( QEvent *event ) override;
    void exposeEvent( QExposeEvent *event ) override;

private:
    bool m_animating = false;

    QOpenGLContext *m_context = nullptr;
    QOpenGLPaintDevice *m_device = nullptr;

public slots:
    void renderLater();
    void renderNow();

signals:
};

#endif // MYOPENGLWINDOW_H
